package com.kafka.consumer;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;

/**
 * @Author: Jiangxx
 * @Date: 2022/01/12
 * @Description:
 */
public class RecordsHandler extends Thread {

    public final ConsumerRecords<String, String> records;

    public RecordsHandler(ConsumerRecords<String, String> records) {
        this.records = records;
    }

    @Override
    public void run() {
        for (ConsumerRecord<String, String> record :records) {
            System.out.println("主题:"+record.topic()+" 分区:"+record.partition()+" 消费位移:"+record.offset()+" 值:"+record.value());
        }
    }
}
